package github.kawaiior.yuanchuxiuzhen.client.gui.market;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import github.kawaiior.yuanchuxiuzhen.Yuanchuxiuzhen;
import github.kawaiior.yuanchuxiuzhen.common.container.ManaStoneConverterContainer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class ManaStoneConverterGUI extends ContainerScreen<ManaStoneConverterContainer> {
    private static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation(Yuanchuxiuzhen.MODID,"/textures/gui/mana_stone_converter.png");

    public ManaStoneConverterGUI(ManaStoneConverterContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
        super(screenContainer, inv, titleIn);
        this.guiLeft=0;
        this.guiTop=0;
        this.xSize=176;
        this.ySize=176;
    }
    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        this.renderBackground(matrixStack);
        super.render(matrixStack, mouseX, mouseY, partialTicks);
        this.renderHoveredTooltip(matrixStack,mouseX,mouseY);
    }

    @Override
    protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int x, int y) {
        this.font.drawText(matrixStack,this.playerInventory.getDisplayName(),(float) this.playerInventoryTitleX,(float) this.playerInventoryTitleY,4210752);
    }

    @Override
    protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
        RenderSystem.color4f(1.0f,1.0f,1.0f,1.0f);
        this.minecraft.textureManager.bindTexture(RESOURCE_LOCATION);

        int x = (this.width - this.xSize) /2;
        int y = (this.height -this.ySize)/2;

        this.blit(matrixStack,x,y,0,0,this.xSize,this.ySize);
    }
}
